{$layout}
{$template "../menu"}

<second-menu>
    <menu-item @click.prevent="createCategory">[添加分类]</menu-item>
</second-menu>

<p class="comment" v-if="categories.length == 0">暂时还没有线路分类。</p>

<div v-if="categories.length > 0">
    <table class="ui table celled selectable" id="sortable-table">
        <thead>
            <tr>
                <th style="width: 3em"></th>
                <th>分类名称</th>
                <th class="width6">状态</th>
                <th class="two op">操作</th>
            </tr>
        </thead>
        <tbody v-for="category in categories" :v-id="category.id">
            <tr>
                <td style="text-align: center;"><i class="icon bars handle grey"></i> </td>
                <td>
                    <a href="" @click.prevent="updateCategory(category.id)">{{category.name}} <i class="icon expand small"></i></a>
                </td>
                <td><label-on :v-is-on="category.isOn"></label-on></td>
                <td>
                    <a href="" @click.prevent="updateCategory(category.id)">修改</a> &nbsp;
                    <a href="" @click.prevent="deleteCategory(category.id)">删除</a>
                </td>
            </tr>
        </tbody>
    </table>

    <p class="comment" v-if="categories.length > 0">可以拖动左侧的<i class="icon bars"></i>排序。</p>
</div>